<?php
class Admin_Model_Article extends My_Model_Db
{
    protected $_name = 'actu';
	protected $_primary  = 'p_actu';
	protected $_mainTable = 'actu';
	protected $_idFieldName = 'p_actu';

	public function getListArticle()
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->order('dtpubli desc');

		return $this->getAdapter()->fetchAll($sql);
	}

	public function getArticle($id)
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->where('p_actu = ?', $id);

		return $this->getAdapter()->fetchRow($sql);
	}

	public function removeArticle($id)
	{
		$this->getAdapter()->delete($this->_name, "p_actu =" . $id);
		return true;
	}

	public function getFichier($id)
	{
	    $sql = "SELECT fichier FROM actu WHERE p_actu = $id";
	    return $this->getAdapter()->fetchRow($sql);
	}

    public function getVignette($id)
	{
	    $sql = "SELECT vignette FROM actu WHERE p_actu = $id";
	    return $this->getAdapter()->fetchRow($sql);
	}
}